export const DEFAULT_HOTKEYS = [
  // Annotation Controls
  {
    id: 100,
    section: "annotation",
    element: "annotation:submit",
    label: "Submit Annotation",
    key: "ctrl+enter",
    description: "Submit the current annotation",
    active: true,
  },
  {
    id: 200,
    section: "annotation",
    element: "annotation:skip",
    label: "Skip Task",
    key: "ctrl+space",
    description: "Skip the current task",
    active: true,
  },
  {
    id: 300,
    section: "annotation",
    element: "annotation:undo",
    label: "Undo",
    key: "ctrl+z",
    description: "Undo last action",
    active: true,
  },
  {
    id: 400,
    section: "annotation",
    element: "annotation:redo",
    label: "Redo",
    key: "ctrl+shift+z",
    description: "Redo previously undone action",
    active: true,
  },

  // Data Manager
  {
    id: 500,
    section: "data_manager",
    element: "dm.focus-previous",
    label: "Focus Previous Task",
    key: "shift+up",
    description: "Move focus to the previous task",
    active: true,
  },
  {
    id: 600,
    section: "data_manager",
    element: "dm.focus-next",
    label: "Focus Next Task",
    key: "shift+down",
    description: "Move focus to the next task",
    active: true,
  },
  {
    id: 700,
    section: "data_manager",
    element: "dm.close-labeling",
    label: "Focus Closed Task",
    key: "shift+left",
    description: "Focus on the closed task column",
    active: true,
  },
  {
    id: 800,
    section: "data_manager",
    element: "dm.open-labeling",
    label: "Focus Open Task",
    key: "shift+right",
    description: "Focus on the open task column",
    active: true,
  },
  {
    id: 900,
    section: "data_manager",
    element: "dm.toggle-bulk-sidebar-minimization",
    label: "Toggle Bulk Sidebar",
    key: "shift+.",
    description: "Minimize or expand bulk actions sidebar",
    active: true,
  },

  // Region Management
  {
    id: 1100,
    section: "regions",
    element: "region:delete-all",
    label: "Delete All Regions",
    key: "ctrl+backspace",
    description: "Remove all regions",
    active: true,
  },
  {
    id: 1200,
    section: "regions",
    element: "region:focus",
    label: "Focus First Region",
    key: "enter",
    description: "Move focus to the first focusable region",
    active: true,
  },
  {
    id: 1300,
    section: "regions",
    element: "region:relation",
    label: "Create Region Relation",
    key: "alt+r",
    description: "Create a relation between selected regions",
    active: true,
  },
  {
    id: 1400,
    section: "regions",
    element: "region:visibility",
    label: "Toggle Region Visibility",
    key: "alt+h",
    description: "Show or hide the selected region",
    active: true,
  },
  {
    id: 1500,
    section: "regions",
    element: "region:visibility-all",
    label: "Toggle All Region Visibility",
    key: "ctrl+h",
    description: "Show or hide all regions",
    active: true,
  },
  {
    id: 1600,
    section: "regions",
    element: "region:lock",
    label: "Lock Region",
    key: "alt+l",
    description: "Lock or unlock the selected region",
    active: true,
  },
  {
    id: 1700,
    section: "regions",
    element: "region:meta",
    label: "Edit Region Metadata",
    key: "alt+m",
    description: "Edit metadata for selected region",
    active: true,
  },
  {
    id: 1800,
    section: "regions",
    element: "region:unselect",
    label: "Unselect Region",
    key: "u",
    description: "Deselect the currently selected region",
    active: true,
  },
  {
    id: 1900,
    section: "regions",
    element: "region:exit",
    label: "Exit Region Mode",
    key: "escape",
    description: "Exit relation mode and unselect region",
    active: true,
  },
  {
    id: 2000,
    section: "regions",
    element: "region:delete",
    label: "Delete Selected Region",
    key: "backspace",
    description: "Delete currently selected region",
    active: true,
  },
  {
    id: 2100,
    section: "regions",
    element: "region:cycle",
    label: "Cycle Regions",
    key: "alt+.",
    description: "Cycle through all regions",
    active: true,
  },
  {
    id: 2200,
    section: "regions",
    element: "region:duplicate",
    label: "Duplicate Region",
    key: "ctrl+d",
    description: "Create a copy of the selected region",
    active: true,
  },
  {
    id: 2300,
    section: "regions",
    element: "segment:delete",
    label: "Delete Segment",
    key: "delete",
    description: "Delete selected segment",
    active: true,
  },

  // Editor - Audio Controls
  {
    id: 2400,
    section: "audio",
    element: "audio:back",
    label: "Rewind 1 Second",
    key: "ctrl+b",
    description: "Rewind the audio by 1 second",
    active: true,
  },
  {
    id: 2500,
    section: "audio",
    element: "audio:playpause",
    label: "Play / Pause Audio",
    key: "ctrl+p",
    description: "Toggle audio playback",
    active: true,
  },
  {
    id: 2600,
    section: "audio",
    element: "audio:step-backward",
    label: "Step Back",
    key: "alt+a",
    description: "Step back one frame",
    active: true,
  },
  {
    id: 2700,
    section: "audio",
    element: "audio:step-forward",
    label: "Step Forward",
    key: "alt+d",
    description: "Step forward one frame",
    active: true,
  },

  // Editor - Video Controls
  {
    id: 2800,
    section: "video",
    element: "media:playpause",
    label: "Play / Pause Video",
    key: "ctrl+alt+space",
    description: "Toggle video playback",
    active: true,
  },
  {
    id: 2900,
    section: "video",
    element: "media:step-backward",
    label: "Step Back",
    key: "alt+left",
    description: "Step one frame backward",
    active: true,
  },
  {
    id: 3000,
    section: "video",
    element: "media:step-forward",
    label: "Step Forward",
    key: "alt+right",
    description: "Step one frame forward",
    active: true,
  },
  {
    id: 3100,
    section: "video",
    element: "video:keyframe-backward",
    label: "Previous Keyframe",
    key: "ctrl+alt+left",
    description: "Jump to previous keyframe",
    active: true,
  },
  {
    id: 3200,
    section: "video",
    element: "video:keyframe-forward",
    label: "Next Keyframe",
    key: "ctrl+alt+right",
    description: "Jump to next keyframe",
    active: true,
  },
  {
    id: 3300,
    section: "video",
    element: "video:backward",
    label: "Seek Backward",
    key: "alt+left",
    description: "Seek video backward",
    active: true,
  },
  {
    id: 3400,
    section: "video",
    element: "video:rewind",
    label: "First Frame",
    key: "shift+ctrl+alt+left",
    description: "Jump to first frame",
    active: true,
  },
  {
    id: 3500,
    section: "video",
    element: "video:forward",
    label: "Seek Forward",
    key: "shift+alt+right",
    description: "Seek video forward",
    active: true,
  },
  {
    id: 3600,
    section: "video",
    element: "video:fastforward",
    label: "Last Frame",
    key: "shift+ctrl+alt+right",
    description: "Jump to last frame",
    active: true,
  },
  {
    id: 3700,
    section: "video",
    element: "video:hop-backward",
    label: "Hop Backward",
    key: "shift+alt+left",
    description: "Hop backward quickly",
    active: true,
  },
  {
    id: 3800,
    section: "video",
    element: "video:hop-forward",
    label: "Hop Forward",
    key: "shift+alt+right",
    description: "Hop forward quickly",
    active: true,
  },

  // Editor - Time Series Controls
  {
    id: 3900,
    section: "timeseries",
    element: "ts:grow-left",
    label: "Extend Left",
    key: "left",
    description: "Extend the region to the left",
    active: true,
  },
  {
    id: 4000,
    section: "timeseries",
    element: "ts:grow-right",
    label: "Extend Right",
    key: "right",
    description: "Extend the region to the right",
    active: true,
  },
  {
    id: 4100,
    section: "timeseries",
    element: "ts:shrink-left",
    label: "Shrink Left",
    key: "alt+left",
    description: "Shrink the region from the left",
    active: true,
  },
  {
    id: 4200,
    section: "timeseries",
    element: "ts:shrink-right",
    label: "Shrink Right",
    key: "alt+right",
    description: "Shrink the region from the right",
    active: true,
  },
  {
    id: 4300,
    section: "timeseries",
    element: "ts:grow-left-large",
    label: "Extend Left (Large)",
    key: "shift+left",
    description: "Extend region left significantly",
    active: true,
  },
  {
    id: 4400,
    section: "timeseries",
    element: "ts:grow-right-large",
    label: "Extend Right (Large)",
    key: "shift+right",
    description: "Extend region right significantly",
    active: true,
  },
  {
    id: 4500,
    section: "timeseries",
    element: "ts:shrink-left-large",
    label: "Shrink Left (Large)",
    key: "shift+alt+left",
    description: "Shrink region from left significantly",
    active: true,
  },
  {
    id: 4600,
    section: "timeseries",
    element: "ts:shrink-right-large",
    label: "Shrink Right (Large)",
    key: "shift+alt+right",
    description: "Shrink region from right significantly",
    active: true,
  },

  // Image Gallery Controls
  {
    id: 4700,
    section: "image_gallery",
    element: "image:prev",
    label: "Previous Image",
    key: "ctrl+left",
    description: "View previous image",
    active: true,
  },
  {
    id: 4800,
    section: "image_gallery",
    element: "image:next",
    label: "Next Image",
    key: "ctrl+right",
    description: "View next image",
    active: true,
  },

  {
    id: 5000,
    section: "tools",
    element: "tool:zoom-in",
    label: "Zoom In",
    key: "ctrl+plus",
    description: "Zoom in on the image",
    active: true,
  },
  {
    id: 5100,
    section: "tools",
    element: "tool:pan-image",
    label: "Pan Image",
    key: "H",
    description: "Pan around the image",
    active: true,
  },
  {
    id: 5200,
    section: "tools",
    element: "tool:zoom-to-fit",
    label: "Zoom to Fit",
    key: "shift+1",
    description: "Zoom to fit the full image in view",
    active: true,
  },
  {
    id: 5300,
    section: "tools",
    element: "tool:zoom-to-actual",
    label: "Zoom to 100%",
    key: "shift+2",
    description: "Zoom to actual image size (100%)",
    active: true,
  },
  {
    id: 5400,
    section: "tools",
    element: "tool:zoom-out",
    label: "Zoom Out",
    key: "ctrl+minus",
    description: "Zoom out of the image",
    active: true,
  },
  {
    id: 5401,
    section: "tools",
    element: "tool:move",
    label: "Move Tool",
    key: "V",
    description: "Select the move tool to reposition annotations",
    active: true,
  },
  {
    id: 5402,
    section: "tools",
    element: "tool:brush",
    label: "Brush Tool",
    key: "B",
    description: "Select the brush tool",
    active: true,
  },

  {
    id: 5500,
    section: "tools",
    element: "tool:ellipse",
    label: "Ellipse Tool",
    key: "O",
    description: "Select the ellipse tool",
    active: true,
  },
  {
    id: 5600,
    section: "tools",
    element: "tool:eraser",
    label: "Eraser Tool",
    key: "E",
    description: "Select the eraser tool",
    active: true,
  },
  {
    id: 5700,
    section: "tools",
    element: "tool:auto-detect",
    label: "Auto Detect",
    key: "M",
    description: "Use the auto-detect tool to automatically suggest regions",
    active: true,
  },
  {
    id: 5900,
    section: "tools",
    element: "tool:key-point",
    label: "Key Point Tool",
    key: "K",
    description: "Select the key point annotation tool",
    active: true,
  },
  {
    id: 6000,
    section: "tools",
    element: "tool:magic-wand",
    label: "Magic Wand",
    key: "W",
    description: "Select the magic wand tool for smart region selection",
    active: true,
  },
  {
    id: 6100,
    section: "tools",
    element: "tool:polygon",
    label: "Polygon Tool",
    key: "P",
    description: "Select the polygon annotation tool",
    active: true,
  },
  {
    id: 6200,
    section: "tools",
    element: "tool:rect",
    label: "Rectangle Tool",
    key: "R",
    description: "Select the rectangle annotation tool",
    active: true,
  },
  {
    id: 6201,
    section: "tools",
    element: "tool:rect-3point",
    label: "3-Point Rectangle",
    key: "shift+R",
    description: "Draw a rotated rectangle using 3-point selection",
    active: true,
  },

  {
    id: 6300,
    section: "tools",
    element: "tool:rotate-left",
    label: "Rotate Left",
    key: "alt+left",
    description: "Rotate the image 90° to the left",
    active: true,
  },
  {
    id: 6400,
    section: "tools",
    element: "tool:rotate-right",
    label: "Rotate Right",
    key: "alt+right",
    description: "Rotate the image 90° to the right",
    active: true,
  },
  {
    id: 6700,
    section: "tools",
    element: "tool:decrease-tool",
    label: "Decrease Tool Size",
    key: "[",
    description: "Decrease tool size",
    active: true,
  },
  {
    id: 6800,
    section: "tools",
    element: "tool:increase-tool",
    label: "Increase Tool Size",
    key: "]",
    description: "Increase tool size",
    active: true,
  },

  // Paragraph Navigation
  {
    id: 6900,
    section: "paragraphs",
    element: "phrases:next-phrase",
    label: "Next Phrase",
    key: "ctrl+down",
    description: "Navigate to the next phrase in paragraph view",
    active: true,
  },
  {
    id: 7000,
    section: "paragraphs",
    element: "phrases:previous-phrase",
    label: "Previous Phrase",
    key: "ctrl+up",
    description: "Navigate to the previous phrase in paragraph view",
    active: true,
  },
  {
    id: 7100,
    section: "paragraphs",
    element: "phrases:select_all_annotate",
    label: "Select All and Annotate",
    key: "ctrl+shift+a",
    description: "Select all text in current phrase and create annotation",
    active: true,
  },
  {
    id: 7200,
    section: "paragraphs",
    element: "phrases:next-region",
    label: "Next Region in Phrase",
    key: "ctrl+right",
    description: "Navigate to the next region within current phrase",
    active: true,
  },
  {
    id: 7300,
    section: "paragraphs",
    element: "phrases:previous-region",
    label: "Previous Region in Phrase",
    key: "ctrl+left",
    description: "Navigate to the previous region within current phrase",
    active: true,
  },
];

export const HOTKEY_SECTIONS = [
  {
    id: "annotation",
    title: "Annotation Actions",
    description: "Shortcuts for common annotation tasks like submit, skip, undo and redo",
  },

  {
    id: "data_manager",
    title: "Data Manager",
    description: "Shortcuts for navigating and managing tasks in Project's Data Manager",
  },

  {
    id: "regions",
    title: "Region Management",
    description: "Shortcuts for creating, selecting and manipulating annotation regions",
  },

  {
    id: "tools",
    title: "Tools",
    description: "Shortcuts for controlling tools panel when labeling images",
  },

  {
    id: "audio",
    title: "Audio Controls",
    description: "Shortcuts for controlling audio playback and navigation",
  },
  {
    id: "video",
    title: "Video Controls",
    description: "Shortcuts for controlling video playback and navigation",
  },
  {
    id: "timeseries",
    title: "Time Series Controls",
    description: "Shortcuts for manipulating time series data regions",
  },
  {
    id: "image_gallery",
    title: "Image Gallery Navigation",
    description: "Shortcuts for navigating between images in multi-image tasks",
  },
  {
    id: "paragraphs",
    title: "Paragraph Navigation",
    description: "Shortcuts for navigating phrases and regions in paragraph/dialogue view",
  },
];

/**
 * URL patterns mapped to their corresponding hotkey sections
 * Used to automatically determine which shortcuts to display based on current page
 */
export const URL_TO_SECTION_MAPPING = [
  {
    regex: /\/projects\/\d+\/data\/?\?.*task=\d+/i,
    section: ["annotation", "regions"],
  },
  {
    regex: /\/projects\/\d+\/data\/?$/i,
    section: "data_manager",
  },
];
